package com.kly.sc.api.application.controller.config.request;

import com.fqgj.common.api.ParamsObject;
import com.kly.sc.api.application.enums.ConfigsType;
import com.kly.sc.api.application.utils.ValidateParams;
import java.util.Objects;

/**
 * @author linqu
 */
public class ConfigRequest extends ParamsObject {
    /**
     * 需要的配置参数码
     */
    private Integer code;

    private String appsFlyerUid;

    private String adid;

    private String channel;

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getAppsFlyerUid() {
        return appsFlyerUid;
    }

    public void setAppsFlyerUid(String appsFlyerUid) {
        this.appsFlyerUid = appsFlyerUid;
    }

    public String getAdid() {
        return adid;
    }

    public void setAdid(String adid) {
        this.adid = adid;
    }


    public static ConfigRequest toConfigRequest(Integer code) {
        final ConfigRequest configRequest = new ConfigRequest();
        configRequest.setCode(code);
        return configRequest;
    }


    @Override
    public void validate() {
        ValidateParams.assertTrue(Objects.isNull(this.code), "The parameter [code] should not be empty!");
        ValidateParams.assertTrue(Objects.isNull(ConfigsType.fromType(this.code)), "The parameter [code] invalid!");
    }
}
